{% extends "admin/change_form.html" %}
{% load i18n admin_urls static admin_list %}


{% block content %}
<div class="col-md-12">
    <div class="row">

        <form action="" method="post" id="quality_form">
            {% csrf_token %}
        <div class="col-md-9">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h4 class="box-title">
                        项目修改
                    </h4>
                </div>
                <input type="hidden" name="id" value="{{ object_id }}" />
                <div class="box-body">
                    <div class="form-group">
                        <div class="row">
                            <label class="col-sm-2 control-label text-right">项目名称</label>
                            <div class="col-sm-7">
                                <span class="text-red" style="margin-left: -10px;">* </span>
                                <input type="text" name="project_name" class="vTextField" value="{{ project.project_name }}" maxlength="100" required="" id="project_name">
                                <div class="help-block red"></div>
                            </div>
                            <div class="col-sm-3">
                                <div class="help-block text-red"></div>
                            </div>
                        </div>

                        <div class="row">
                            <label class="col-sm-2 control-label text-right">项目描述</label>
                            <div class="col-sm-7">
                                <span class="text-red" style="margin-left: -10px;">* </span>
                                <textarea name="project_desc" cols="40" rows="3" class="" required="">{{ project.project_desc }}</textarea>
                                <div class="help-block red"></div>
                            </div>
                            <div class="col-sm-3">
                                <div class="help-block text-red"></div>
                            </div>
                        </div>

                        <div class="row">
                            <label class="col-sm-2 control-label text-right">项目成员</label>
                            <div class="col-sm-7">
                                <span class="text-red" style="margin-left: -10px;">&nbsp; </span>
                                <select class="select2" multiple="multiple" style="width: 100%;" name="owner[]" >
                                    {% for user in user_list %}
                                        <option  value="{{ user.id }}" {% if user.id in project_user_list %} selected {% endif %}>{{ user.username }}</option>
                                    {% endfor %}
                                </select>
                                <div class="help-block red"></div>
                            </div>
                            <div class="col-sm-3">
                                <div class="help-block text-red"></div>
                            </div>
                        </div>




                    </div>
                </div>

            </div>

        </div>

        <div class="col-md-3 hidden-sm hidden-xs">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h4 class="box-title">
                        操作面板
                    </h4>
                </div>

                <div class="box-body">
                    <div class="form-group">
                        <input type="submit" value="修改" class="btn btn-primary form-control" name="_save">
                    </div>

                    <div class="form-group">
                        <input type="button" value="返回项目列表" id="return_project" class="btn btn-primary form-control" name="_save">
                    </div>
                </div>

            </div>

        </div>
        </form>
    </div>

</div>

{% endblock %}

{% block extrajs %}
<script>
$(".select2").select2();
$("#return_project").click(function(){
    window.location.href='/admin/schedule/project'
});
</script>
{% endblock %}